import React, { Component } from 'react'
import axios from 'axios'
import {Route,NavLink,Switch,Redirect} from 'react-router-dom'


export default class List extends Component {
    constructor(props) {
        super(props)
        this.state = {
            list: []
        }
        this.getList()
    }

    componentDidMount() {
    }

    getList() {
        axios.get('https://shopapi.smartisan.com/mobile/skulist?page=1').then((res) => {
            console.log(res.data.data.skuInfo)
            this.setState({
                list: res.data.data.skuInfo
            })
        })
    }

    render() {
        return (
            <div className="goods-list">
                <h3>猜你喜欢</h3>
                <ul>
                    {
                        this.state.list.map((item) => {
                            return <NavLink to={'/Item/'+item.skuId}>
                            <li key={item.skuId}>
                                <img src={item.images} />
                                <p>{item.skuName}</p>
                                {/* <span>{item.discountPrice}</span> */}
                                <p>
                                <span className="left">￥<b>{item.originalPrice}</b></span>
                                <span className="right">{item.promotionList[0].tag}</span>
                                </p>
                                
                            </li>
                            </NavLink>
                        })
                    }
                </ul>
            </div>
        )
    }
}
